<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>添加</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="/static/css/font.css">
        <link rel="stylesheet" href="/static/css/xadmin.css">
        <script type="text/javascript" src="/static/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="/static/js/xadmin.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
            <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
            <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
		<div class="x-nav">
          <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row">
				  <div class="layui-tab-content">
					 <div class="layui-form-item">
						<div class="layui-inline">
						  <label class="layui-form-label"><a href="{:url('admin/import/download',['do'=>'a'])}" style="color:red;text-decoration:underline;">模板下载</a></label>
						</div>
						<div class="layui-inline">
						  <label class="layui-form-label">导入</label>
						  <div class="layui-input-inline">
								<input type="file" name="excel" id="file" class="layui-input" />
						  </div>
						</div>
					 </div>
				  </div>
            </div>
        </div>
        <script>
		var flag = true;
		layui.use(['upload', 'layer'],
            function() {
			var $ = layui.jquery
				,upload = layui.upload
				,layer = layui.layer;
				upload.render({
					elem: '#file'
					,url: '/admin/import/importgongyinshang'
					,accept: 'file' //普通文件
					,exts: 'xls' //只允许上传文件格式
					,done: function(res){
					console.log(res);
					  if(res.code == 10001)
					  {
						 layer.msg("导入成功", {
								icon: 6
							},
							function() {
								//关闭当前frame
								xadmin.close();
								// 可以对父窗口进行刷新 
								xadmin.father_reload();
							});
					  }else{
						layer.msg(res.msg, {
								icon: 6
							},
							function() {
								//关闭当前frame
								xadmin.close();
								// 可以对父窗口进行刷新 
								xadmin.father_reload();
							});
					  }
					}
				  });
               
            });
		</script>
    </body>

</html>
